package com.pgeg.registry;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import static com.pgeg.listener.BlockListener.*;
import static com.pgeg.util.Reference.MODID;

public class BlockRegistry {


    public static void registerBlock() {
        /*Ores*/
        initBlock("mana_crystal_ore", MANA_CRYSTAL_ORE);
        initBlock("orichalcum_ore", ORICHALCUM_ORE);
        initBlock("saturnium_ore", SATURNIUM_ORE);
        initBlock("brimstone_ore", BRIMSTONE_ORE);
        initBlock("meteorite_ore", METEORITE_ORE);
        initBlock("mithril_ore", MITHRIL_ORE);
        initBlock("copper_ore", COPPER_ORE);
        initBlock("silver_ore", SILVER_ORE);
        initBlock("air_infused_stone", AIR_INFUSED_STONE);
        initBlock("fire_infused_stone", FIRE_INFUSED_STONE);
        initBlock("earth_infused_stone", EARTH_INFUSED_STONE);
        initBlock("water_infused_stone", WATER_INFUSED_STONE);
        initBlock("order_infused_stone", ORDER_INFUSED_STONE);
        initBlock("entropy_infused_stone", ENTROPY_INFUSED_STONE);

        /*MetalBlocks*/
        initBlock("mana_dust_block", MANA_DUST_BLOCK);
        initBlock("orichalcum_block", ORICHALCUM_BLOCK);
        initBlock("saturnium_block", SATURNIUM_BLOCK);
        initBlock("brimstone_block", BRIMSTONE_BLOCK);
        initBlock("meteorite_block", METEORITE_BLOCK);
        initBlock("mithril_block", MITHRIL_BLOCK);
        initBlock("copper_block", COPPER_BLOCK);
        initBlock("silver_block", SILVER_BLOCK);

        /*Bricks*/
        initBlock("cactus_brick", CACTUS_BRICK);
        initBlock("iron_brick", IRON_BRICK);
        initBlock("coal_brick", COAL_BRICK);
    }

    private static void initBlock(String path, Block block) {
        Registry.register(Registry.BLOCK, new Identifier(MODID, path), block);
        Registry.register(Registry.ITEM, new Identifier(MODID, path), new BlockItem(block, new FabricItemSettings().group(ItemGroupRegistry.COMMON_GROUP)));
    }
}
